﻿@using ExpressManagement.Areas.BackSys.ServiceTools;
@using DAL.Models;
@using Microsoft.AspNetCore.Http;
@using Newtonsoft.Json
@{
    var sess = Context.Session;
    string? userName = sess.GetString("userName");
    string? loginType = sess.GetString("loginType");
    int userID = 0;
    string? jsonStr = sess.GetString("detail");
    UserInfo? user = null;
    Deliveryman? deliveryman=null;
    Manager? manager = null;
    if (jsonStr != null)
    {
         switch (loginType)
        {
            case "用户":
           
                user = JsonConvert.DeserializeObject<UserInfo>(jsonStr);
                if(user!=null)
                userID = user.Id;
                break;
            case "快递员":
                deliveryman = JsonConvert.DeserializeObject<Deliveryman>(jsonStr);
                if(deliveryman!=null)
                userID = deliveryman.Id;
                break;
            case "管理员":
                manager = JsonConvert.DeserializeObject<Manager>(jsonStr);
                if(manager!=null)
                userID = manager.Id;
                break;
            default:
                break;
        }
    }
   
}
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>系统主页</title>
    <link href="~/Content/bootstrap.min.css" rel="stylesheet" />
    <meta http-equiv="Content-Type" content="text/html/application/json; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta http-equiv="content-security-policy" content="upgrade-insecure-requests" />
    <meta name="description" content="">
    <meta name="author" content="ThemeBucket">
    @*<link href="~/Content/font" rel="stylesheet" />*@
    <link rel="shortcut icon"  type="image/png">
    <!--icheck-->
    <link href="~/Content/backSys/js/iCheck/skins/minimal/minimal.css" rel="stylesheet">
    <link href="~/Content/backSys/js/iCheck/skins/square/square.css" rel="stylesheet">
    <link href="~/Content/backSys/js/iCheck/skins/square/red.css" rel="stylesheet">
    <link href="~/Content/backSys/js/iCheck/skins/square/blue.css" rel="stylesheet">

    <!--dashboard calendar-->
    <link href="~/Content/backSys/css/clndr.css" rel="stylesheet">
    <!--Morris Chart CSS -->
    <link rel="stylesheet" href="~/Content/backSys/js/morris-chart/morris.css">
    <!--common-->
    <link href="~/Content/backSys/css/style.css" rel="stylesheet">
    <link href="~/Content/backSys/css/style-responsive.css" rel="stylesheet">
    @if (IsSectionDefined("CssLink"))
    {
        @RenderSection("CssLink");
    }
    @if (IsSectionDefined("Style"))
    {
        @RenderSection("Style");
    }



</head>



<body class="sticky-header">

    <section>
        <!-- left side start-->
        <div class="left-side sticky-left-side">

            <!--logo and iconic logo start-->
            <div class="logo">
                <a href="@Url.Action("IndexPart","Welcome")">
                    <img src="~/Content/backSys/images/logo.png" alt="">
                </a>
            </div>

            <div class="logo-icon text-center">

                <a href="@Url.Action("IndexPart","Welcome")"><img src="~/Content/backSys/images/logo_icon.png" alt=""></a>
            </div>
            <!--logo and iconic logo end-->

            <div class="left-side-inner">

                <!-- visible to small devices only -->
                <div class="visible-xs hidden-sm hidden-md hidden-lg">
                    <div class="media logged-user">
                        <img alt="" src="~/Content/backSys/images/photos/user-avatar.png" class="media-object">
                        <div class="media-body">
                            <h4><a>     @userName</a></h4>
                            <span>"Hello There..."</span>
                        </div>
                    </div>

                    <h5 class="left-nav-title">账户信息</h5>

                    <ul class="nav nav-pills nav-stacked custom-nav">
                        <li><a><i class="fa fa-user"></i> <span>个人资料</span></a></li>
                        <li><a><i class="fa fa-cog"></i> <span>设置</span></a></li>
                        <li><a><i class="fa fa-sign-out"></i> <span>登出</span></a></li>
                    </ul>
                </div>

                <!--sidebar nav start-->
                <ul class="nav nav-pills nav-stacked custom-nav">
                    <li class="menu-list">
                            <a onclick="callPage('IndexPart','Welcome')">
                            <i class="fa fa-home"></i> 
                            <span>系统首页</span>
                           
                    </a>
                      <ul class="sub-menu-list">

                       </ul>
                    </li>
                    <li class="menu-list">
                            <a onclick="callPage('MessageManage','Message')"><i class="fa fa-tasks"></i> <span>消息中心</span></a>
                                                <ul class="sub-menu-list">

                       </ul>
                    </li>
                    <li class="menu-list" id="bag">
                        <a><i class="fa fa-laptop"></i> <span>快递管理</span></a>
                        <ul class="sub-menu-list">

                            @if (!loginType.Equals("用户"))
                            {
                                <li id="bagSend">
                                    <a onclick="callPage('BagSend','Bag')"><span>快递派送</span></a>
                                </li>
                            }
                            else
                            {
                                <li id="bagRegister">
                                <a onclick="callPage('BagRegister','Bag')"><span>快递登记</span></a>

                                </li>

                            }
                            <li id="bagManage">
                              <a onclick="callPage('BagManage','Bag')"><span>快递查询</span></a>
                            </li>
                        </ul>
                    </li>

                    @if (!loginType.Equals("用户"))
                    {
                        <li class="menu-list" id="user">
                            <a><i class="fa fa-users"></i> <span>用户管理</span></a>
                            <ul class="sub-menu-list">
                                <li id="userManage">
                                   <a onclick="callPage('UserManage','User')"><span>用户管理</span></a>
                                 
                                </li>
                                <li id="userRegister">
                                 <a onclick="callPage('UserRegister','User')"><span>用户注册</span></a>
                                </li>
                            </ul>
                        </li>
                        <li class="menu-list" id="deliveryman">
                            <a><i class="fa fa-users"></i> <span>公司通讯录</span></a>
                            <ul class="sub-menu-list">
                                <li id="deliverymanRegister">
                                <a onclick="callPage('DeliverymanRegister','Deliveryman')"><span>快递员注册</span></a>
                                 
                                </li>
                                <li id="deliverymanManage">
                                <a onclick="callPage('DeliverymanManage','Deliveryman')"><span>快递员管理</span></a>
                                </li>
                            </ul>
                        </li>

                    }


                    <li class="menu-list" id="complaint">
                        <a><i class="fa fa-comment-o"></i> <span>投诉管理</span></a>
                        <ul class="sub-menu-list">

                            <li id="complaintManage">
                              <a onclick="callPage('ComplaintManage','Complaint')"><span>投诉管理</span></a>
                            </li>
                            @if (loginType.Equals("用户"))
                            {
                                <li id="complaintSubmit">
                                <a onclick="callPage('ComplaintSubmit','Complaint')"><span>投诉提交</span></a>
                                </li>

                            }
                        </ul>
                    </li>
                    @if (loginType.Equals("管理员"))
                    {
                        <li class="menu-list" id="manager">
                            <a><i class="fa fa-umbrella"></i> <span>管理员管理</span></a>
                            <ul class="sub-menu-list">
                                <li id="managerRegister">
                                     <a onclick="callPage('ManagerRegister','Manager')"><span>管理员注册</span></a>
                                </li>
                                <li id="managerManage">
                                 <a onclick="callPage('ManagerManage','Manager')"><span>管理员管理</span></a>
                                </li>
                            </ul>
                        </li>
                    }

                    @*<li class="menu-list">
            <a ><i class="fa fa-bar-chart-o"></i> <span>Charts</span></a>
            <ul class="sub-menu-list">
                <li><a href="flot_chart.html"> Flot Charts</a></li>
                <li><a href="morris.html"> Morris Charts</a></li>
                <li><a href="chartjs.html"> Chartjs</a></li>
                <li><a href="c3chart.html"> C3 Charts</a></li>
            </ul>
        </li>
        <li class="menu-list nav-active">
            <a ><i class="fa fa-th-list"></i> <span>Data Tables</span></a>
            <ul class="sub-menu-list">
                <li><a href="basic_table.html"> Basic Table</a></li>
                <li class="active"><a href="dynamic_table.html"> Advanced Table</a></li>
                <li><a href="responsive_table.html"> Responsive Table</a></li>
                <li><a href="editable_table.html"> Edit Table</a></li>
            </ul>
        </li>

        <li class="menu-list">
            <a ><i class="fa fa-map-marker"></i> <span>Maps</span></a>
            <ul class="sub-menu-list">
                <li><a href="google_map.html"> Google Map</a></li>
                <li><a href="vector_map.html"> Vector Map</a></li>
            </ul>
        </li>
        <li class="menu-list">
            <a ><i class="fa fa-file-text"></i> <span>Extra Pages</span></a>
            <ul class="sub-menu-list">
                <li><a href="profile.html"> SelfInfomation</a></li>
                <li><a href="invoice.html"> Invoice</a></li>
                <li><a href="pricing_table.html"> Pricing Table</a></li>
                <li><a href="timeline.html"> Timeline</a></li>
                <li><a href="blog_list.html"> Blog List</a></li>
                <li><a href="blog_details.html"> Blog Details</a></li>
                <li><a href="directory.html"> Directory </a></li>
                <li><a href="chat.html"> Chat </a></li>
                <li><a href="404.html"> 404 Error</a></li>
                <li><a href="500.html"> 500 Error</a></li>
                <li><a href="registration.html"> Registration Page</a></li>
                <li><a href="lock_screen.html"> Lockscreen </a></li>
            </ul>
        </li>
        <li><a href="login.html"><i class="fa fa-sign-in"></i> <span>Login Page</span></a></li>*@

                </ul>
                <!--sidebar nav end-->

            </div>
        </div>
        <!-- left side end-->
        <!-- main content start-->
        <div class="main-content">

            <!-- header section start-->
            <div class="header-section">

                <!--toggle button start-->
                <a class="toggle-btn"><i class="fa fa-bars"></i></a>
                <!--toggle button end-->
                <!--search start-->
                <form class="searchform" action="index.html" method="post">
                    <input type="text" class="form-control" name="keyword" placeholder="Search here..." />
                </form>
                <!--search end-->
                <!--notification menu start -->
                <div class="menu-right">
                    <ul class="notification-menu">
                        @*<li>
                                <a  class="btn btn-default dropdown-toggle info-number" data-toggle="dropdown">
                                    <i class="fa fa-tasks"></i>
                                    <span class="badge">8</span>
                                </a>
                                <div class="dropdown-menu dropdown-menu-head pull-right">
                                    <h5 class="title">You have 8 pending task</h5>
                                    <ul class="dropdown-list user-list">
                                        <li class="new">
                                            <a >
                                                <div class="task-info">
                                                    <div>Database update</div>
                                                </div>
                                                <div class="progress progress-striped">
                                                    <div style="width: 40%" aria-valuemax="100" aria-valuemin="0" aria-valuenow="40" role="progressbar" class="progress-bar progress-bar-warning">
                                                        <span class="">40%</span>
                                                    </div>
                                                </div>
                                            </a>
                                        </li>
                                        <li class="new">
                                            <a >
                                                <div class="task-info">
                                                    <div>Dashboard done</div>
                                                </div>
                                                <div class="progress progress-striped">
                                                    <div style="width: 90%" aria-valuemax="100" aria-valuemin="0" aria-valuenow="90" role="progressbar" class="progress-bar progress-bar-success">
                                                        <span class="">90%</span>
                                                    </div>
                                                </div>
                                            </a>
                                        </li>
                                        <li>
                                            <a >
                                                <div class="task-info">
                                                    <div>Web Development</div>
                                                </div>
                                                <div class="progress progress-striped">
                                                    <div style="width: 66%" aria-valuemax="100" aria-valuemin="0" aria-valuenow="66" role="progressbar" class="progress-bar progress-bar-info">
                                                        <span class="">66% </span>
                                                    </div>
                                                </div>
                                            </a>
                                        </li>
                                        <li>
                                            <a >
                                                <div class="task-info">
                                                    <div>Mobile App</div>
                                                </div>
                                                <div class="progress progress-striped">
                                                    <div style="width: 33%" aria-valuemax="100" aria-valuemin="0" aria-valuenow="33" role="progressbar" class="progress-bar progress-bar-danger">
                                                        <span class="">33% </span>
                                                    </div>
                                                </div>
                                            </a>
                                        </li>
                                        <li>
                                            <a >
                                                <div class="task-info">
                                                    <div>Issues fixed</div>
                                                </div>
                                                <div class="progress progress-striped">
                                                    <div style="width: 80%" aria-valuemax="100" aria-valuemin="0" aria-valuenow="80" role="progressbar" class="progress-bar">
                                                        <span class="">80% </span>
                                                    </div>
                                                </div>
                                            </a>
                                        </li>
                                        <li class="new"><a >See All Pending Task</a></li>
                                    </ul>
                                </div>
                            </li>*@
                        @*<li>
                                <a  class="btn btn-default dropdown-toggle info-number" data-toggle="dropdown">
                                    <i class="fa fa-envelope-o"></i>
                                    <span class="badge">5</span>
                                </a>
                                <div class="dropdown-menu dropdown-menu-head pull-right">
                                    <h5 class="title">You have 5 Mails </h5>
                                    <ul class="dropdown-list normal-list">
                                        <li class="new">
                                            <a >
                                                <span class="thumb"><img src="~/Content/backSys/images/photos/user1.png" alt="" /></span>
                                                <span class="desc">
                                                    <span class="name">@userName <span class="badge badge-success">new</span></span>
                                                    <span class="msg">Lorem ipsum dolor sit amet...</span>
                                                </span>
                                            </a>
                                        </li>
                                        <li>
                                            <a >
                                                <span class="thumb"><img src="~/Content/backSys/images/photos/user2.png" alt="" /></span>
                                                <span class="desc">
                                                    <span class="name">Jonathan Smith</span>
                                                    <span class="msg">Lorem ipsum dolor sit amet...</span>
                                                </span>
                                            </a>
                                        </li>
                                        <li>
                                            <a >
                                                <span class="thumb"><img src="~/Content/backSys/images/photos/user3.png" alt="" /></span>
                                                <span class="desc">
                                                    <span class="name">Jane Doe</span>
                                                    <span class="msg">Lorem ipsum dolor sit amet...</span>
                                                </span>
                                            </a>
                                        </li>
                                        <li>
                                            <a >
                                                <span class="thumb"><img src="~/Content/backSys/images/photos/user4.png" alt="" /></span>
                                                <span class="desc">
                                                    <span class="name">Mark Henry</span>
                                                    <span class="msg">Lorem ipsum dolor sit amet...</span>
                                                </span>
                                            </a>
                                        </li>
                                        <li>
                                            <a >
                                                <span class="thumb"><img src="~/Content/backSys/images/photos/user5.png" alt="" /></span>
                                                <span class="desc">
                                                    <span class="name">Jim Doe</span>
                                                    <span class="msg">Lorem ipsum dolor sit amet...</span>
                                                </span>
                                            </a>
                                        </li>
                                        <li class="new"><a >Read All Mails</a></li>
                                    </ul>
                                </div>
                            </li>*@
                        <li >
                            <div id="base">
                                <a id="messageMenu" class="btn btn-default dropdown-toggle info-number" data-toggle="dropdown">
                                    <i class="fa fa-bell-o" @*class="fa fa-bell-o"*@></i>
                                    <span v-if="messages.length>0" id="messageNum" class="badge">{{messages.length}}</span>
                                </a>
                                <div class="dropdown-menu dropdown-menu-head pull-right">
                                    <h5 class="title">通知</h5>
                                    <ul id="messageCenter" class="dropdown-list normal-list">
                                        <li class="new" v-for="(message,index) in messages"  v-on:click.prevent="hasRead(message)">
                                            <a href="">
                                                <span class="label label-danger">
                                                    <i class="fa fa-bolt"></i>
                                                </span>
                                                <span class="name">
                                                    {{message}}
                                                </span>
                                                <em class="small">
                                                    {{formatDateTime2(Date.now())}}
                                                </em>
                                            </a>
                                        </li>
                                        <li v-if="messages.length>0" class="new">
                                            <a href="" v-on:click.prevent="hasReadAll">
                                                <span class="label label-danger">
                                                    <i class="fa fa-dot-circle-o"></i>
                                                </span>
                                                <span>所有通知设置为已读</span>
                                            </a>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        
                        </li>
                        <li>
                            <a class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                                <img src="~/Content/backSys/images/photos/user-avatar.png" alt="" />
                                @userName
                                <span class="caret"></span>
                            </a>
                            <ul class="dropdown-menu dropdown-menu-usermenu pull-right">
                                <li>
                                        <a onclick="callPage('SelfInfomation','Welcome')"><i class="fa fa-user"></i><span>个人资料</span></a>
                                </li>
                                <li>
                                        <a onclick="callPage('SelfInfomation','Welcome')"><i class="fa fa-cog"></i><span>设置</span></a>

                                </li>
                                <li>
                                        <a onclick="logOut('LogOut','Welcome')"><i class="fa fa-sign-out"></i><span>注销</span></a>
                                </li>
                            </ul>
                        </li>

                    </ul>
                </div>
                <!--notification menu end -->

            </div>
            <!-- header section end-->
            <!-- page heading start-->
            <!--<div class="page-heading">-->
            <!--Page Tittle goes here-->
            <!--</div>-->
            <!-- page heading end-->
            <!--body wrapper start-->
            @*<div>
                    <iframe  width="100%" src="@Url.Action("SelfInfomation","Welcome")">
                    </iframe>
                </div>*@
            <div id="myView">
                <div class="wrapper">

                    <div class="panel">
                        <div class="panel-body invoice">
                            <div class="row">
                                <div class="col-md-4 col-sm-4">
                                    <h1 class="invoice-title">invoice</h1>
                                </div>
                                <div class="col-md-4 col-md-offset-4 col-sm-4 col-sm-offset-4">
                                    <img class="inv-logo" src="~/Content/backSys/images/invoice-logo.jpg" alt="" />
                                    <p>
                                        121 King Street, Melbourne <br />
                                        Victoria 3000 Australia <br />
                                        Phone: +61 3 8376 6284
                                    </p>
                                </div>
                            </div>
                            <div class="invoice-address">
                                <div class="row">
                                    <div class="col-md-5 col-sm-5">
                                        <h4 class="inv-to">Invoice To</h4>
                                        <h2 class="corporate-id">Envato</h2>
                                        <p>
                                            121 King Street, Melbourne<br>
                                            Victoria 3000 Australia<br>
                                            Phone: +61 3 8376 6284,
                                            Email : info@envato.com
                                        </p>

                                    </div>
                                    <div class="col-md-4 col-md-offset-3 col-sm-4 col-sm-offset-3">
                                        <div class="inv-col"><span>Invoice#</span> 432134-A</div>
                                        <div class="inv-col"><span>Invoice Date :</span> 22 March 2014</div>
                                        <h1 class="t-due">TOTAL DUE</h1>
                                        <h2 class="amnt-value">$ 3120.00</h2>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <table class="table table-bordered table-invoice">
                            <thead>
                                <tr>
                                    <th>#</th>
                                    <th>Item Description</th>
                                    <th class="text-center">Unit Cost</th>
                                    <th class="text-center">Quantity</th>
                                    <th class="text-center">Total</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td>1</td>
                                    <td>
                                        <h4>Service One</h4>
                                        <p>Service Four Description Lorem ipsum dolor sit amet.</p>
                                    </td>
                                    <td class="text-center"><strong>$ 599.00</strong></td>
                                    <td class="text-center"><strong>4</strong></td>
                                    <td class="text-center"><strong>$2396.00</strong></td>
                                </tr>
                                <tr>
                                    <td>2</td>
                                    <td>
                                        <h4>Service Two</h4>
                                        <p>Service Four Description Lorem ipsum dolor sit amet.</p>
                                    </td>
                                    <td class="text-center"><strong>$ 599.00</strong>	</td>
                                    <td class="text-center"><strong>5</strong></td>
                                    <td class="text-center"><strong>$2995.00</strong></td>
                                </tr>
                                <tr>
                                    <td>3</td>
                                    <td>
                                        <h4>Service Three</h4>
                                        <p>Service Four Description Lorem ipsum dolor sit amet.</p>
                                    </td>
                                    <td class="text-center"><strong>$ 599.00</strong>	</td>
                                    <td class="text-center"><strong>2</strong></td>
                                    <td class="text-center"><strong>$1198.00</strong></td>
                                </tr>
                                <tr>
                                    <td colspan="2" class="payment-method">
                                        <h4>Payment Method</h4>
                                        <p>1. Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
                                        <p>2. Pellentesque tincidunt pulvinar magna quis rhoncus.</p>
                                        <p>3. Cras rhoncus risus vitae congue commodo.</p>
                                        <br>
                                        <h3 class="inv-label">Thank you for your business</h3>
                                    </td>
                                    <td class="text-right" colspan="2">
                                        <p>Sub Total</p>
                                        <p>Tax (VAT 10%)</p>
                                        <p>Discount (5%)</p>
                                        <p><strong>GRAND TOTAL</strong></p>
                                    </td>
                                    <td class="text-center">
                                        <p>$ 6589.00</p>
                                        <p>$ 120.00</p>
                                        <p>$ 60.00</p>
                                        <p><strong>$ 5120.00</strong></p>
                                    </td>
                                </tr>

                            </tbody>
                        </table>
                    </div>
                    <div class="text-center ">
                        <a class="btn btn-success btn-lg"><i class="fa fa-check"></i> Submit Invoice </a>
                        <a class="btn btn-primary btn-lg" target="_blank" href="invoice_print.html"><i class="fa fa-print"></i> Print </a>
                    </div>

                </div>

            </div>








        </div>
        <!--footer section start-->
        <footer class="">
            2022 &copy; AdminEx by ThemeBucket
        </footer>
        <!--footer section end-->
        <!-- main content end-->
    </section>







    <script src="~/Content/backSys/js/jquery-1.10.2.min.js"></script>
    <script src="~/Content/backSys/js/jquery-ui-1.9.2.custom.min.js"></script>
    <script src="~/Content/backSys/js/jquery-migrate-1.2.1.min.js"></script>
    <script src="~/Content/backSys/js/bootstrap.min.js"></script>
    <script src="~/Content/backSys/js/modernizr.min.js"></script>
    <script src="~/Content/backSys/js/jquery.nicescroll.js"></script>
    <!--common scripts for all pages-->
    <script src="~/Content/backSys/js/scripts.js"></script>

    <!--dynamic table initialization -->
    <!--Vue.js -->
    @*<script src="~/Content/BackSys/js/vue.min.js"></script>*@
    <script src="~/js/vue.js"></script>
    <script src="~/js/axios.js"></script>
    <script src="~/js/vue-router.js"></script>

    <script src="~/js/signalr/dist/browser/signalr.js"></script>
    <script src="~/chat.js"></script>
    <script>
                Array.prototype.remove = function (val) {
                    var index = this.indexOf(val)
                    if (index > -1) {
                        this.splice(index, 1)
                    }
                }
              var vm = new Vue({
               el: "#base",
               data: {
                   chat :null,
                   messages:[],
                },
                methods: {
                     formatDateTime2 :function(str) {
                        if (str == "") return str;
                        //console.log(str);
                        var now = new Date(str);
                        var year = now.getFullYear();  //取得4位数的年份
                        var month = now.getMonth() + 1;  //取得日期中的月份，其中0表示1月，11表示12月
                        /*   if (month < 10) month = '0' + month;*/
                        var date = now.getDate();      //返回日期月份中的天数（1到31）
                        //if (date < 10) date = '0' + date;
                        var hour = now.getHours();     //返回日期中的小时数（0到23）
                        //if (hour < 10) hour = '0' + hour;
                        var minute = now.getMinutes(); //返回日期中的分钟数（0到59）
                        if (minute < 10) minute = '0' + minute;
                        var second = now.getSeconds(); //返回日期中的秒数（0到59）
                        if (second < 10) second = '0' + second;
                        return year + "/" + month + "/" + date + " " + hour + ":" + minute + ":" + second;
                    },


                    formatDateTime : function (str) {
                        if (str == "") return str;
                        var now = new Date(parseInt(str.replace("/Date(", "").replace(")/", ""), 10));
                        var year = now.getFullYear();  //取得4位数的年份
                        var month = now.getMonth() + 1;  //取得日期中的月份，其中0表示1月，11表示12月
                        var date = now.getDate();      //返回日期月份中的天数（1到31）
                        var hour = now.getHours();     //返回日期中的小时数（0到23）
                        var minute = now.getMinutes(); //返回日期中的分钟数（0到59）
                        var second = now.getSeconds(); //返回日期中的秒数（0到59）
                        return year + "-" + month + "-" + date + " " + hour + ":" + minute + ":" + second;
                    },


                                // 编辑表单
                    get_info: function (id, type) {
                            //console.log('传入的id为:' + id + '.类型' + typeof (id));
                            var sendData = new FormData();
                            sendData.append('id', id);
                            sendData.append('Action', $('#act').val());

                            if (id == null) {
                                alert('Error！');
                                return false;
                            }
                            id = id.toString();

                            axios({
                                  headers: {
                                        'Content-Type': 'application/json'
                                    },
                                method: "post",
                                //Content-type:"application/json",
                                data: sendData,
                                responseType: 'json',
                                // `transformRequest` 允许在向服务器发送前，修改请求数据
                                // 只能用在 'PUT', 'POST' 和 'PATCH' 这几个请求方法
                                // 后面数组中的函数必须返回一个字符串，或 ArrayBuffer，或 Stream
                                transformRequest: [function (data) {
                                    // 对 data 进行任意转换处理
                                    return data;
                                }],
                                // `transformResponse` 在传递给 then/catch 前，允许修改响应数据
                                transformResponse: [function (data) {
                                    // 对 data 进行任意转换处理
                                    return data;
                                }],
                                url: "@Url.Action("GetItemByID", "Deliveryman")"

                            }).then((data) => {
                                //console.log(data);
                                // 解析json数据
                                //var data = data;
                                //var data_obj = eval("(" + data + ")");
                                // 将JSON编码的字符串转换为JS对象
                                var data_obj = JSON.parse(data.data);
                                //tool =  new datesFn();
                                //console.log(typeof (data_obj.SendDate));
                                // 赋值
                                vm.id = data_obj.id;
                                vm.UserName = data_obj.UserName;
                                vm.UserPass = data_obj.UserPass;
                                vm.TrueName = data_obj.TrueName;
                                vm.Phone = data_obj.Phone;
                                vm.Idcard = data_obj.Idcard;

                            }).catch(error => {
                                alert(error);
                            });

                        },
                        // 提交表单
                      //向页面添加消息
                    ShowMessage: function (message) {
                        commonUtil.message("消息提示", message, "success");
                        /*$('#list').append('<li>' + message + '</li>');*/
                        //$('#messageCenter').prepend('<li class="new" id=\'' + 12 + '\'> <a href = "" ><span class="label label-danger"><i class="fa fa-bolt"></i></span> <span class="name">' + message + '.  </span><em class="small">' + Date.now() + '</em></a ></li > ');
                        this.messages.push(message);
                        //console.log(this.messages);
                    },


                    hasRead: function (message) {
                        this.messages.remove(message);
                    },
                    hasReadAll: function () {
                        this.messages = [];
                    }



                },
                watch: {


               },
               mounted: function () {
                   //var url = "http://localhost:44381"
                   var connection = new signalR.HubConnectionBuilder().withUrl("/chatHub", {
                       skipNegotiation: true,
                        transport: signalR.HttpTransportType.WebSockets
                   }).build();
              
              

                    //Disable the send button until connection is established.
                    //document.getElementById("sendButton").disabled = true;
                    //connection.on("ReceiveMessage", function (user, message) {
                    //    var li = document.createElement("li");
                    //    document.getElementById("messagesList").appendChild(li);
                    //    // We can assign user-supplied strings to an element's textContent because it
                    //    // is not interpreted as markup. If you're assigning in any other way, you 
                    //    // should be aware of possible script injection concerns.
                    //    li.textContent = `${user} says ${message}`;
                    //});
                    connection.on("ReceiveMessage", function (message) {
                        vm.ShowMessage(message);
                    });

                    connection.start().then(function () {
                        //document.getElementById("sendButton").disabled = false;
                        connection.invoke("UserLogin", ' @userID', '@loginType').catch(function (err) {
                            return console.error(err.toString());
                        });
                        //console.log('发送');
                        event.preventDefault();
                    }).catch(function (err) {
                        return console.error(err.toString());
                    });

                    //document.getElementById("sendButton").addEventListener("click", function (event) {
                    //    var user = document.getElementById("userInput").value;
                    //    var message = document.getElementById("messageInput").value;
                    //    connection.invoke("SendMessage", user, message).catch(function (err) {
                    //        return console.error(err.toString());
                    //    });
                    //    event.preventDefault();
                    //});
                    // //RestoreNavigation();
                    ////引用服务端的集线器代理类
                    //var chat = $.connection.ChatHub;
                    //if (chat == null) {

                    //    console.log("signalR在页面启动");
                    //} else {
                    //    console.log("signalR重新启动");
                    //}

                    ////定义服务器端调用的客户端SendMessage方法来显示新消息
                    //chat.client.ReceiveMessage = function (message) {
                    //    vm.ShowMessage(message);
                    //};
                    ////开始连接服务器
                    //$.connection.hub.start().done(function () {
                    //    chat.server.init();
                    //    chat.server.userlogin(' @userID', '@loginType');
                    //    console.log('发送');
                    //});
               },
               created() {
                   var act = $('#act').val()
                   $("li a").mouseover(function () {
                       $(this).css('cursor', 'pointer');
                   })
                }
              });




            function trigger_stay(params) {
            $('#act').val('keep');
        }
            function trigger_update(params) {
            $('#act').val('update');
        }
            function trigger_delete(params) {
            $('#act').val('delete');
        }
            function trigger_add(params) {
            $('#act').val('add');
        }


            function removeNullOrUndefined(obj) {
            //typeof 返回的是字符串，有六种可能："number"、"string"、"boolean"、"object"、"function"、"undefined"
            if (typeof (obj) == "undefined" || obj == "" || obj == null || obj == "null" || obj.length == 0) {
                return "";
            } else {
                //删除全是空格的情况
                var regu = "^[ ]+$";
                var re = new RegExp(regu);
                if (re.test(obj)) {
                    return "";
                } else {
                    return obj;
                }

            }
        }


        function logOut(action,controller){
                 //console.log("注销" + action + controller);
                 sendUrl = controller + '/' + action;
                 $.ajax({
                                //data: sendData,
                                data: [],
                                url: sendUrl,
                                type: 'post',
                                dataType: 'html',
                                contentType:'application/json/html',
                                //cache: false,
                                //processData: false,
                                //contentType: false,
                                error: function () {
                                    //console.log("22222");
                                },
                                success: function (data) {
                                  if(data==1){
                                       window.location.href = "@Url.Action("Login", "Home")";
                                  }
                                }

                            });
            }


            function callPage(action, controller) {
            //console.log("callPage" + action + controller);
                sendUrl = controller + '/' + action;

            //sendData = JSON.stringify({ Controller: controller, Action: action })
            $.ajax({
                //data: sendData,
                data: [],
                url: sendUrl,
                type: 'post',
                dataType: 'html',
                contentType:'application/json/html',
                //cache: false,
                //processData: false,
                //contentType: false,
                error: function () {
                    //console.log("22222");
                },
                success: function (data) {
                    //console.log(data);
                    //data = JSON.stringify(data);
                    $('#myView').html(data);
                    //console.log(data);

                }

            });
        }

            function callReady(userID) {
                $.ajax({
                            url: "@Url.Action("Ready","Welcome")",
                            type: 'post',
                            data: {
                                'userID': userID,
                                'loginType': '@loginType'
                            },
                            dataType: 'JSON',
                            cache: false,
                            processData: false,
                             contentType: false,
                            error: function () {
                                //console.log("22222");
                            },
                            success: function (data) {
                                //data = JSON.stringify(data);
                                //console.log(data);

                              }

                          });
                  }

            //设置cookie
            function setCookie(name, value) {
            //console.log('setcookie' + '  ' + value);
                delCookie(name);
                document.cookie = name + "=" + escape(value);
                //document.cookie = name + "=" + escape (value)+";path="+"/";
            }
            //设置cookie :value为日期时
            function setDateCookie(name, value) {
                var Days = 30;
                var exp = new Date();
                exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
                document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString();
            }
            //获取cookie
            function getCookie(name) {
                var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
                //console.log(arr);
                if (arr = document.cookie.match(reg))
                    return unescape(arr[2]);
                else
                    return null;
            }
            //删除cookie
            function delCookie(name) {
                var exp = new Date();
                exp.setTime(exp.getTime() - 1);
                var cval = getCookie(name);
                if (cval != null)
                    document.cookie = name + "=" + cval + ";expires=" + exp.toGMTString();
            }
            var commonUtil = {
                /**
                 * 弹出消息框
                 * param msg 消息内容
                 * param type 消息框类型（参考bootstrap的alert）
                 */
                alert: function (title, msg, type) {
                    if (typeof (type) == "undefined") { // 未传入type则默认为success类型的消息框
                        type = "success";
                    }
                    // 创建bootstrap的alert元素
                    var divElement = $("<div></div>").addClass('alert').addClass('alert-' + type).addClass('alert-dismissible').addClass('col-md-4').addClass('col-md-offset-4');
                    divElement.css({ // 消息框的定位样式
                        "position": "absolute",
                        "right": "20px",
                        "top": "80px"
                    });

                    divElement.text(title); // 设置消息框的内容
                    var h = $('<h5><i class="icon-ok-sign"></i>' + msg + '</h5>');
                    $(divElement).append(h);
                    // 消息框添加可以关闭按钮
                    var closeBtn = $('<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>');
                    $(divElement).append(closeBtn);
                    // 消息框放入到页面中
                    $('body').append(divElement);
                    return divElement;
                },

                /**
                 * 短暂显示后上浮消失的消息框
                 * param msg 消息内容
                 * param type 消息框类型
                 */
                message: function (title, msg, type) {
                    var divElement = commonUtil.alert(title, msg, type); // 生成Alert消息框
                    var isIn = false; // 鼠标是否在消息框中

                    divElement.on({ // 在setTimeout执行之前先判定鼠标是否在消息框中
                        mouseover: function () { isIn = true; },
                        mouseout: function () { isIn = false; }
                    });

                    // 短暂延时后上浮消失
                    setTimeout(function () {
                        var IntervalMS = 20; // 每次上浮的间隔毫秒
                        var floatSpace = 60; // 上浮的空间(px)
                        var nowTop = divElement.offset().top; // 获取元素当前的top值
                        var stopTop = nowTop - floatSpace;    // 上浮停止时的top值
                        divElement.fadeOut(IntervalMS * floatSpace); // 设置元素淡出

                        var upFloat = setInterval(function () { // 开始上浮
                            if (nowTop >= stopTop) { // 判断当前消息框top是否还在可上升的范围内
                                divElement.css({ "top": nowTop-- }); // 消息框的top上升1px
                            } else {
                                clearInterval(upFloat); // 关闭上浮
                                divElement.remove();    // 移除元素
                            }
                        }, IntervalMS);

                        if (isIn) { // 如果鼠标在setTimeout之前已经放在的消息框中，则停止上浮
                            clearInterval(upFloat);
                            divElement.stop();
                        }

                        divElement.hover(function () { // 鼠标悬浮时停止上浮和淡出效果，过后恢复
                            clearInterval(upFloat);
                            divElement.stop();
                        }, function () {
                            divElement.fadeOut(IntervalMS * (nowTop - stopTop)); // 这里设置元素淡出的时间应该为：间隔毫秒*剩余可以上浮空间
                            upFloat = setInterval(function () { // 继续上浮
                                if (nowTop >= stopTop) {
                                    divElement.css({ "top": nowTop-- });
                                } else {
                                    clearInterval(upFloat); // 关闭上浮
                                    divElement.remove();    // 移除元素
                                }
                            }, IntervalMS);
                        });
                    }, 1500);
                }
    };
    </script>


    @if (IsSectionDefined("JavascriptLink"))
    {
        @RenderSection("JavascriptLink");
    }
    @if (IsSectionDefined("Javascript"))
    {
        @RenderSection("Javascript");
    }

    @section Javascript{


    }
</body>








@*<script src="~/Scripts/jquery-3.2.1.min.js"></script>
    <script src="~/Scripts/bootstrap.min.js"></script>*@

<!-- Placed js at the end of the document so the pages load faster -->



</html>
